package edu.ccut.titan.tag.report.servlet;

import java.util.HashMap;
import java.util.Map;

import edu.ccut.titan.tag.report.exporter.*;

public abstract class ReportExporterFactory implements IReport {
	
	private static Map<String, IReportExporter> exporters;
	
	static {
		initalExporters();
	}
	
	private static void initalExporters() {
		exporters = new HashMap<String, IReportExporter>();
		
		exporters.put(TYPE_HTML, new HtmlReportExporter());
		exporters.put(TYPE_PDF, new PDFReportExporter());
		exporters.put(TYPE_EXCEL, new ExcelReportExporter());
		exporters.put(TYPE_CSV, new CSVReportExporter());
		exporters.put(TYPE_RTF, new RTFReportExporter());
		exporters.put(TYPE_XML, new XMLReportExporter());
		exporters.put(TYPE_PRINT, new ObjectReportExporter());
	}
	
	public static IReportExporter getReportExporter(String type) {
		return exporters.get(type);
	}
	
	public static IReportExporter getDefaultReportExporter() {
		return exporters.get(TYPE_HTML);
	}
}
